#define _CRT_SECURE_NO_WARNINGS 1

#include"SListNode.h"

void test1()
{
	SListNode* plist = NULL;

	SListPushBack(&plist, 1);
	SListPushBack(&plist, 2);
	SListPushBack(&plist, 3);
	SListPushFront(&plist, 4);
	SListPrint(plist);

	SListPopFront(&plist);
	SListPopBack(&plist);
	SListPrint(plist);

	SLTDestroy(&plist);
}

void test2()
{
	SListNode* plist = NULL;

	SListPushBack(&plist, 1);
	SListPushBack(&plist, 2);
	SListPushBack(&plist, 3);
	SListPushFront(&plist, 4);
	SListPrint(plist);

	SListPopFront(&plist);
	SListPrint(plist);

	SLTDestroy(&plist);
}

void test3()
{
	SListNode* plist = NULL;

	SListPushBack(&plist, 1);
	SListPushBack(&plist, 2);
	SListPushBack(&plist, 3);
	SListPushFront(&plist, 4);
	SListPrint(plist);

	SListNode* pos = SListFind(plist, 3);
	SListInsertAfter(pos, 5);
	SListPrint(plist);

	pos = SListFind(plist, 1);
	SListEraseAfter(pos);
	SListPrint(plist);

	SLTDestroy(&plist);
}

void test4()
{
	SListNode* plist = NULL;

	SListPushBack(&plist, 1);
	SListPushBack(&plist, 2);
	SListPushBack(&plist, 3);
	SListPushFront(&plist, 4);
	SListPrint(plist);

	SListNode* pos = SListFind(plist, 3);
	SLTInsert(&plist, pos, 5);
	SListPrint(plist);

	pos = SListFind(plist, 1);
	SLTErase(&plist, pos);
	SListPrint(plist);

	SLTDestroy(&plist);
}

int main()
{
	test1();
	test2();
	test3();
	test4();
	return 0;
}